<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>

</head>
<body>
<!--    导航条-->
<nav class="navbar navbar-default" th:fragment="comment_header">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">小乖乖</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="/">小乖乖</a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <form class="navbar-form navbar-left" action="/" method="get">
                <div class="form-group">
                    <input name="search" type="text" th:value="${search}" class="form-control" placeholder="搜索话题">
                </div>
                <button type="submit" class="btn btn-default">搜索</button>
            </form>
            <ul class="nav navbar-nav navbar-right">
                <li>
                    <a style="color: red">[[${publishError}]]</a>
                </li>
                <li>
                    <a href="/publish">发布</a>
                </li>
                <li>
                    <a href="/profile/replies">通知 <span class="badge" th:text="${session.unReadCount}">0</span></a>
                </li>
                <li class="dropdown" th:if="${session.user != null}">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                       aria-haspopup="true" aria-expanded="false">
                        [[${session.user.getName()}]]
                        <span class="caret"></span>
                    </a>
                    <ul class="dropdown-menu">
                        <li><a href="/profile/questions">消息中心</a></li>
                        <li><a href="#">个人资料</a></li>
                        <li><a href="/logout">退出</a></li>
                    </ul>
                </li>
                <li th:unless="${session.user}">
                    <a th:href="@{https://github.com/login/oauth/authorize(client_id='Iv1.d3f81f3d40813f8a',redirect_uri=${#httpServletRequest.getRequestURL()+'callback'},scope='user',state=1)}">
                        登录
                    </a>
                </li>
            </ul>
        </div>
    </div>
</nav>


</body>
</html>